<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" th:href="@{/bootstrap/css/bootstrap.css}">
    <link rel="stylesheet" th:href="@{/css/common.css}">
    <style>
        td {
            text-overflow: ellipsis;
            overflow: hidden;
            white-space: nowrap;
        }

    </style>
</head>
<body>
<div th:insert="~{common/header::header1}"></div>
<div class="container-fluid">
    <div class="row">
        <form class="form-horizontal" th:action="@{/trip-info/showLimit}">
            <div class="form-group">
                <label for="date" class="col-md-1 control-label">日期</label>
                <div class="col-md-10">
                    <input type="text" class="form-control" id="date" name="date" placeholder="例如：2021-01-01">
                </div>
            </div>
            <div class="form-group">
                <label for="vehicleNum" class="col-md-1 control-label">车次</label>
                <div class="col-md-10">
                    <input type="text" class="form-control" id="vehicleNum" name="vehicleNum"
                           placeholder="车次或航班等，如：KN5868 或 CA912">
                </div>
            </div>
            <div class="form-group">
                <label for="place" class="col-md-1 control-label">地区</label>
                <div class="col-md-10">
                    <input type="text" class="form-control" id="place" name="place" placeholder="可不填，例如：成都 或 四川">
                </div>
            </div>
            <div class="form-group">
                <label for="place" class="col-md-1 control-label"></label>
                <div class="col-md-10">
                    <button type="submit" class="btn btn-primary">提交</button>
                    <button type="reset" class="btn btn-danger">重置</button>
                </div>
            </div>
        </form>
        <div class="col-md-12">
            <div class="btn-group" role="group" aria-label="...">
                <a th:href="@{/trip-info/show?type=0}" class="btn btn-default">全部</a>
                <a th:href="@{/trip-info/show?type=1}" class="btn btn-default">飞机</a>
                <a th:href="@{/trip-info/show?type=2}" class="btn btn-default">火车</a>
                <a th:href="@{/trip-info/show?type=3}" class="btn btn-default">地铁</a>
                <a th:href="@{/trip-info/show?type=4}" class="btn btn-default">长途客车/大巴</a>
                <a th:href="@{/trip-info/show?type=5}" class="btn btn-default">公交车</a>
                <a th:href="@{/trip-info/show?type=6}" class="btn btn-default">出租车</a>
                <a th:href="@{/trip-info/show?type=7}" class="btn btn-default">轮船</a>
                <a th:href="@{/trip-info/show?type=8}" class="btn btn-default">其他公共场所</a>
            </div>
            <table style="table-layout: fixed" class="table table-striped table-bordered table-condensed table-hover">
                <colgroup>
                    <col span="9" width="11%">
                </colgroup>
                <thead>
                <tr>
                    <th>线索来源</th>
                    <th>日期</th>
                    <th>行程类型</th>
                    <th>车次/车牌/航班/场所名</th>
                    <th>车厢</th>
                    <th>出发站</th>
                    <th>到达站</th>
                    <th>出发时间</th>
                    <th>到达时间</th>
                </tr>
                </thead>
                <tbody>
                <tr th:each="list:${pageInfo.list}">
                    <td th:text="${list.getSource()}"></td>
                    <td th:text="${#dates.format(list.getDate(),'yyyy-MM-dd')}"></td>
                    <td th:if="${list.getTripTypeNum() eq 1}" th:text="飞机"></td>
                    <td th:if="${list.getTripTypeNum() eq 2}" th:text="火车"></td>
                    <td th:if="${list.getTripTypeNum() eq 3}" th:text="地铁"></td>
                    <td th:if="${list.getTripTypeNum() eq 4}" th:text="大巴"></td>
                    <td th:if="${list.getTripTypeNum() eq 5}" th:text="公交车"></td>
                    <td th:if="${list.getTripTypeNum() eq 6}" th:text="出租车"></td>
                    <td th:if="${list.getTripTypeNum() eq 7}" th:text="轮船"></td>
                    <td th:if="${list.getTripTypeNum() eq 8}" th:text="其他公共场所"></td>
                    <td th:text="${list.getVehicleNum()}"></td>
                    <td th:if="${list.getCarriageNum() ne '-1'}" th:text="${list.getCarriageNum()}"></td>
                    <td th:if="${list.getCarriageNum() eq '-1'}"></td>
                    <td th:text="${list.getStartPlace()}"></td>
                    <td th:text="${list.getEndPlace()}"></td>
                    <td th:text="${#dates.format(list.getStartDate(),'yyyy-MM-dd HH:mm:ss')}"></td>
                    <td th:text="${#dates.format(list.getEndDate(),'yyyy-MM-dd HH:mm:ss')}"></td>
                </tr>
                </tbody>
            </table>
            <nav aria-label="Page navigation example">
                <ul class="pagination">
                    <li class="page-item"><a class="page-link" th:href="@{/trip-info/show(pn=)}">首页</a></li>
                    <li class="page-item" th:if="${pageInfo.hasPreviousPage}">
                        <a class="page-link" th:href="@{/trip-info/show(pn=${pageInfo.pageNum - 1})}">Previous</a>
                    </li>
                    <li th:each="pageNum:${pageInfo.navigatepageNums}">
                        <a th:if="${pageNum==pageInfo.pageNum}" class="page-link" th:href="@{#}"
                           th:text="${pageNum}"></a>
                        <a th:if="${pageNum!=pageInfo.pageNum}" class="page-link"
                           th:href="@{/trip-info/show(pn=${pageNum})}" th:text="${pageNum}"></a>
                    </li>
                    <li class="page-item" th:if="${pageInfo.hasNextPage}">
                        <a class="page-link" th:href="@{/trip-info/show(pn=${pageInfo.pageNum+1})}">Next</a>
                    </li>
                    <li class="page-item">
                        <a class="page-link" th:href="@{/trip-info/show(pn=${pageInfo.pages})}">尾页</a>
                    </li>
                </ul>
            </nav>
        </div>
    </div>
</div>

</body>
<script th:src="@{/jquery/jquery-3.5.1.js}"></script>
<script th:src="@{/bootstrap/js/bootstrap.js}"></script>
<script th:inline="javascript">

</script>
</html>